package be.novelfaces.component.util.attribute;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;

import be.novelfaces.component.util.element.InputType;
import be.novelfaces.component.util.element.InputWriter;

public class InputAttributesWriterBuilder extends AttributesWriterBuilder {
	
	public InputAttributesWriterBuilder(FacesContext context,
			UIComponent component) {
		super(context, component);
	}
	
	public InputAttributesWriterBuilder(FacesContext context,
			UIComponent component, InputWriter inputTextWriter) {
		super(context, component, inputTextWriter);
	}

	public AttributesWriterBuilder withInputTextAttributes() {
		withInputType(InputType.TEXT);
		withAutocomplete();
		getPassThroughAttributes().withInputTextAttributes();
		return this;
	}
	
	public AttributesWriterBuilder withInputType(InputType inputType) {
		addAttribute(TYPE, null, inputType.getName());
		return this;
	}
	
	public AttributesWriterBuilder withAllAttributesForInputText() {
		withName();
		withValue();
		withGlobalAttributes();
		withInputTextAttributes();
		withFormEvents();
		withKeyboardEvents();
		withMouseEvents();
		return this;
	}

}
